﻿using Castle.ActiveRecord;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Online_Course.Domain
{
    [ActiveRecord]
    public class  Course:BaseEntity<Course>
    {
        [Property(Length = 30, NotNull = false)]
        [Display(Name = "课程名")]
        public string Name { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "课程编号")]

        public string CourseCode { get; set; }

        [Property(Length = 200, NotNull = false)]
        [Display(Name = "备注")]
        public string Remark { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "人数")]
        public int Maxpeople { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "已选人数")]
        public int ChoosePeople { get; set; }

        [Property(Length = 30, NotNull = false, Default = "0")]
        [Display(Name = "状态")]
        public int IsActive { get; set; }

        [HasAndBelongsToMany(typeof(Teacher), Table = "Teacher_Course", ColumnKey = "CourseId", ColumnRef = "TeacherId", Cascade = ManyRelationCascadeEnum.None, Lazy = false)]
        [Display(Name = "任课教师")]
        public IList<Teacher> TeacherList { get; set; }

        [HasAndBelongsToMany(typeof(Student), Table = "Student_Course", ColumnKey = "CourseId", ColumnRef = "StudentId", Cascade = ManyRelationCascadeEnum.None, Lazy = false)]
        [Display(Name = "选课学生")]
        public IList<Student> StudentList { get; set; } 
    }
}
